import methodCallTreeGen.MethodCallTreeGen;

import java.io.File;
import java.io.FileNotFoundException;

import static dslProgramGen.DslProgramGen.genDslProgram;
import static dslProgramGen.DslProgramGen.genDslProgramForAllThreads;
import static utils.Utils.isTwoFileEqual;

/**
 * 对ComplexMop自测试集产生standardOutput文件夹内容
 */
public class DslProgramGenStandardOutputForComplexMop {
    /**
     * ComplexMop自测试集总共有多少测试用例
     */
    public static int numsOfTestCase = 9;
    public static String preContentOfFolderPath = "src/test/resources/dslProgramGenForComplexMop/";

    public static void testHelper(int num) throws FileNotFoundException {
        // 预处理后的traces（main线程和其他线程,还有ThreadInfo.txt文件）所在的文件夹路径
        String preProcessedTracesFolderPath = preContentOfFolderPath + "filteredTraces/" + num + "/";
        // 标准输出DSL程序路径
        String standardDslFolderPath = preContentOfFolderPath + "standardOutput/" + num + "/";
        // 生成DSL程序
        genDslProgramForAllThreads(preProcessedTracesFolderPath, standardDslFolderPath);

        // 处理结束后，由于MethodCallTreeGen.methodStartNumForAThread变量为静态变量，会保存上一个testcase的内容，需要对其进行清空
        MethodCallTreeGen.methodStartNumForAThread.clear();
    }

    public static void main(String[] args) throws FileNotFoundException {
        for (int i = 1; i <= numsOfTestCase; i++) {
            testHelper(i);
        }
    }
}
